package com.yotta.operationdatascreencode.web.controller;

import com.yotta.operationdatascreencode.base.entity.TestUserEntity;
import com.yotta.operationdatascreencode.common.core.BasePageResult;
import com.yotta.operationdatascreencode.common.core.R;
import com.yotta.operationdatascreencode.web.request.TestPageReq;
import com.yotta.operationdatascreencode.web.request.TestReq;
import com.yotta.operationdatascreencode.web.response.TestRsp;
import com.yotta.operationdatascreencode.web.serialier.TestUserSerialier;
import com.yotta.operationdatascreencode.web.service.TestUserService;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* 测试用例
 */
@RestController
@RequestMapping("web/test")
@Schema(description = "测试接口")
public class TestController {

    @Resource
    TestUserService testUserService;

    /**
     * 提交表单
     * @param req 请求提
     * @return 结果集
     */
    @PostMapping("/login/put")
    @Schema(description = "登录")
    public R<TestRsp> loginPut(@Validated @RequestBody TestReq req) {
        return R.ok();
    }

    /**
     * 列表
     * @param req 请求提
     * @return 结果集
     */
    @PostMapping("/login/list")
    @Schema(description = "岗位详情")
    public R<BasePageResult<TestRsp>> list(@Validated
                                   @RequestBody TestPageReq req) {
        BasePageResult<TestUserEntity> lList =  testUserService.list(req.getPageNum(),
            req.getPageSize(), req.getName());
        TestUserSerialier.listSerializer(lList);
        return R.ok();
    }
}
